package com.sixbro.shiro.uaa.service;

import com.sixbro.shiro.uaa.model.AuthCode;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * <p>
 *
 * </p>
 *
 * @Author: Mr.Lu
 * @Since: 2020/6/19 17:42
 */
public class AuthCodeServiceImpl implements AuthCodeService {

    private Map<String, AuthCode> db = new ConcurrentHashMap<>(64);

    @Override
    public void save(AuthCode authCode) {
        db.put(authCode.getCode(), authCode);
    }

    @Override
    public AuthCode getByCode(String code) {
        return db.get(code);
    }

    @Override
    public boolean remove(String code) {
        return db.remove(code) != null;
    }
}
